package com.example.dml.factory_pattern.simple_factory_pattern;

import com.example.dml.factory_pattern.ICourse;
import com.example.dml.factory_pattern.JavaCourse;
import com.example.dml.factory_pattern.PythonCourse;

/**
 * @description: 简单工厂模式
 * @author: gaoyang
 * @date: 2021/10/22 00:17
 */
public class CourseFactory {

    public ICourse create(String name){
        if ("java".equals(name)){
            return new JavaCourse();
        }else if ("python".equals(name)){
            return new PythonCourse();
        }else {
            return null;
        }
    }
}
